﻿<%@ WebHandler Language="C#" Class="logcomplaint" %>

using System;
using System.Web;

using AMCBO;
using AMCOBJ;

public class logcomplaint : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        //context.Response.ContentType = "text/plain";
        //context.Response.Write("Hello World");
        complaint compBO = new complaint();
        complaint_obj compObj = new complaint_obj();
        int x = 0;
        if (!string.IsNullOrEmpty(context.Request.QueryString["cid"]))
        {
            compObj.IssueCusID = new Guid(context.Request.QueryString["cid"].ToString());
        }
        if (!string.IsNullOrEmpty(context.Request.QueryString["sid"]))
        {
            compObj.IssueSaleID = new Guid(context.Request.QueryString["sid"].ToString());
        }
        compObj.IssueGuid = Guid.NewGuid();
        compObj.IssueDesc = context.Request.QueryString["desc"].ToString();
        compObj.IssueAssignee = context.Request.QueryString["agnt"].ToString();
        compObj.IssueStatus = context.Request.QueryString["stus"].ToString();
        compObj.IssueID = context.Request.QueryString["issid"].ToString();
        compObj.isSpare = context.Request.QueryString["isSpr"].ToString();
        compObj.SpareDetails = context.Request.QueryString["sprDet"].ToString();
        compObj.Ins_DT = System.DateTime.Now.ToString();
        compObj.Upd_DT = System.DateTime.Now.ToString();
        HttpCookie oCookieID = (HttpCookie)context.Request.Cookies["userid"];
        if (oCookieID.Value != string.Empty)
        {
            compObj.Ins_UserID = new Guid(oCookieID.Value);
            compObj.Ins_UserID = new Guid(oCookieID.Value);
        }

        try
        {
            x = compBO.register_complaint(compObj);
            if (x == 0)
            {
                context.Response.Write("y");
            }
            else
            {
                context.Response.Write("n");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}